package cn.k7g.alloy.ioc;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.validation.beanvalidation.MethodValidationPostProcessor;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.List;


/**
 * 配置web参数
 * @author victor-wu
 * @date 2021/9/27 下午1:10
 */
@Configuration
//@EnableAutoConfiguration(exclude = WebConversionService.class)
public class WebMvcConfig implements WebMvcConfigurer {

    @Autowired
    private AlloyContentResolve alloyContentResolve;

    @Override
    public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
        argumentResolvers.add(alloyContentResolve);
    }
// 支持方法上的验证
//    @Bean
//    public MethodValidationPostProcessor methodValidationPostProcessor() {
//        MethodValidationPostProcessor processor = new MethodValidationPostProcessor();
//        return processor;
//    }

//    @Override
//    public void addFormatters(FormatterRegistry registry) {
//        registry.addConverter(new XConverter());
//    }

//    @Override
//    public void addReturnValueHandlers(List<HandlerMethodReturnValueHandler> handlers) {
//        handlers.add(alloyContentResolve);
//    }

}


